
/*
    IR CMD
*/

#ifndef IR_CMD_H
#define IR_CMD_H

#include <Arduino.h>
#include <IRremote.hpp>
#include "PinDefinitionsAndMore.h" // Define macros for input and output pin etc.
#include "component_l298n.h"

#define IR_CAR_FORWARD 0x47
#define IR_CAR_LEFT 0x48
#define IR_CAR_STOP 0x49
#define IR_CAR_RIGHT 0x4A
#define IR_CAR_BACKWARD 0x4B

#define IR_CAR_SPEED_UP 0X43   // <<
#define IR_CAR_SPEED_DOWN 0x46 // >>

int cur_ir_cmd;

void do_ir_cmd(int ir_cmd)
{
  Serial.println(cur_ir_cmd);
  switch (ir_cmd)
  {
  case IR_CAR_FORWARD:
    cur_car_cmd = CAR_FORWARD;
    break;
  case IR_CAR_LEFT:
    cur_car_cmd = CAR_LEFT;
    break;
  case IR_CAR_RIGHT:
    cur_car_cmd = CAR_RIGHT;
    break;
  case IR_CAR_BACKWARD:
    cur_car_cmd = CAR_BACKWARD;
    break;
  case IR_CAR_STOP:
    cur_car_cmd = CAR_STOP;
    break;
  case IR_CAR_SPEED_UP:
    cur_car_cmd = CAR_SPEED_UP;
    break;
  case IR_CAR_SPEED_DOWN:
    cur_car_cmd = CAR_SPEED_DOWN;
    break;
  default:
    break;
  } // switch
  Serial.print("car cmd: ");
  Serial.println(cur_car_cmd);
  car_action(cur_car_cmd);
};

#endif /* IR_CMD_H */

